import 'package:flutter/material.dart';
//个人中心
class UserHomeIndex extends StatelessWidget {
  const UserHomeIndex({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.white,
        elevation: 0,
        title: Text("个人中心"),
        titleTextStyle: TextStyle(
          color: Colors.black,
          fontSize: 26,
        ),
        leading: Container(
          child:GestureDetector(
            onTap: (){
              Navigator.pop(context);
            },
            child: Icon(Icons.arrow_circle_left,color: Colors.blue,size: 40),
          ),
        ),
      ),
      body: _UserHome(),
    );
  }
}

class _UserHome extends StatefulWidget {
  const _UserHome({Key? key}) : super(key: key);

  @override
  State<_UserHome> createState() => _UserHomeState();
}

class _UserHomeState extends State<_UserHome> {

  final String BackImageUrls="https://img0.baidu.com/it/u=792554660,3933923766&fm=253&fmt=auto&app=138&f=JPEG?w=800&h=500";

  final String UserImageUrls="https://img2.baidu.com/it/u=2091771371,1112634019&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500";

  var strl="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        Container(
          height: double.infinity,
          width: double.infinity,
          alignment: Alignment.topCenter,
          child:Container(
            width: double.infinity,
            // width: double.infinity,
            child: Image.network(BackImageUrls),
          ),
        ),
        Positioned(
            top: 180,
            left: 25,
            child: Container(
              // width: double.infinity,
              width: 340,
              height: 220,
              decoration: BoxDecoration(
                color: Colors.white70,
                borderRadius: BorderRadius.all(Radius.circular(20))
              ),
              child:Container(
                width: double.infinity,
                margin: EdgeInsets.fromLTRB(0, 76, 0, 0),
                child: Column(
                  children: [
                    Center(
                      child:Text("张三",style: TextStyle(fontSize: 26),),
                    ),
                    Row(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: [
                        Text("关注 : 1856",style: TextStyle(fontSize: 16),),
                        Text("    |    ",style: TextStyle(fontSize: 16),),
                        Text("粉丝 : 4.5W",style: TextStyle(fontSize: 16),)
                      ],
                    ),
                    Container(
                      margin: EdgeInsets.all(10),
                      width: double.infinity,
                      height: 60,
                      child: Text(
                        "简介:$strl",
                        style: const TextStyle(
                          fontSize: 14,
                        ),
                        overflow: TextOverflow.clip,
                        textDirection: TextDirection.ltr,
                        maxLines: 3,
                      ),
                    )

                  ],
                ),
              ),
              ),
        ),
        Positioned(
          top: 130,
          left: 135,
          child: Container(
              width: 120,
              height: 120,
              decoration: BoxDecoration(
                borderRadius: BorderRadius.all(Radius.circular(90)),
                image: DecorationImage(
                  image: NetworkImage(UserImageUrls),fit: BoxFit.fill
                )
              ),
            ),
        ),
        Positioned(
            top: 420,
            left: 20,
            child: Container(
              width: 350,
              height: 254,
              decoration: BoxDecoration(
                  color: Colors.black12,
                  borderRadius: BorderRadius.all(Radius.circular(20))
              ),
              padding: EdgeInsets.all(12),
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.start,
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Container(
                    margin: EdgeInsets.all(8),
                    child: Text("账号:2021100589465",style: TextStyle(fontSize: 20),),
                  ),
                  Container(
                    margin: EdgeInsets.all(8),
                    child: Text("邮箱:2422558899@qq.com",style: TextStyle(fontSize: 20),),
                  ),
                  Container(
                    margin: EdgeInsets.all(8),
                    child: Text("手机:13311445588",style: TextStyle(fontSize: 20),),
                  ),
                  Container(
                    margin: EdgeInsets.all(8),
                    child: Text("生日:2023-01-11",style: TextStyle(fontSize: 20),),
                  ),
                  Container(
                    padding: EdgeInsets.fromLTRB(0, 0,10,0),
                    alignment: Alignment.centerRight,
                    child: ElevatedButton(
                      onPressed: (){},
                      child: Text("修改信息"),
                      style: ButtonStyle(
                        backgroundColor: MaterialStateProperty.all(Colors.black)
                      ),
                    ),
                  )
                ],
              ),
            )
        )
      ],
    );
  }
}


